//
//  YHYPriceViewTableViewCell.m
//  Home
//
//  Created by 杨泓晔 on 16/6/28.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "YHYPriceViewTableViewCell.h"

@implementation YHYPriceViewTableViewCell



-(instancetype ) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = [UIColor whiteColor];
        [self creatSubViews];
    }
    return self;
}


- (void)creatSubViews{
    //充值
    UILabel *chonglabel=[[UILabel alloc]init];
    [self addSubview:chonglabel];
    [self setUpChildViewControll:chonglabel backgroundColor:nil alpha:0.8 text:@"充值" textColor:[UIColor blackColor] font:[UIFont systemFontOfSize:16]];
    [chonglabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(self).offset(28/2 *AUTO_WIDTH);
        make.left.equalTo(self).offset(57/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(80 *AUTO_WIDTH, 25 *AUTO_WIDTH));
    }];
    
    
    //日期
    _dataLabel=[[UILabel alloc]init];
    _dataLabel.text = @"2016-06-27 18:17:38";
    _dataLabel.textColor = ZI;
    [self addSubview:_dataLabel];
    _dataLabel.font = [UIFont fontWithName:nil size:14];
    [_dataLabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(chonglabel.mas_bottom).offset(12/2 *AUTO_WIDTH);
        make.left.equalTo(self).offset(57/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(160 *AUTO_WIDTH, 18 *AUTO_WIDTH));
    }];
    
    //横线
    UIImageView *henglabel=[[UIImageView alloc]init];
    //    [self setUpChildViewControll:henglabel backgroundColor:[UIColor grayColor] alpha:0.4 text:nil textColor:nil font:nil];
    [self addSubview:henglabel];
    henglabel.image = [UIImage imageNamed:@"虚线"];
    [henglabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_dataLabel.mas_bottom).offset(12/2 *AUTO_WIDTH);
        make.left.equalTo(self).offset(57/2 *AUTO_WIDTH);
        make.right.equalTo(self).offset(-57/2 *AUTO_WIDTH);
        make.height.mas_equalTo(1 *AUTO_WIDTH);
    }];
    
    //0.10
    _priceL=[[UILabel alloc]init];
    [self setUpChildViewControll:_priceL backgroundColor:[UIColor whiteColor] alpha:0.5 text:@"0.10" textColor:nil font:[UIFont fontWithName:SHUZI size:26]];
    [self addSubview:_priceL];
    [_priceL mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.mas_equalTo(self).offset(53/2 *AUTO_WIDTH);
        make.right.mas_equalTo(self).offset(-63/2 *AUTO_WIDTH);
        make.bottom.mas_equalTo(henglabel.mas_top).offset(-36/2 *AUTO_WIDTH);
    }];
    
    
    //加号
    UILabel *jialabel=[[UILabel alloc]init];
    [self addSubview:jialabel];
    [self setUpChildViewControll:jialabel backgroundColor:[UIColor whiteColor] alpha:0.5 text:@"+" textColor:nil font:[UIFont fontWithName:SHUZI size:26]];
    [jialabel mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(self).offset(58/2 *AUTO_WIDTH);
        make.right.equalTo(_priceL.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(14 *AUTO_WIDTH, 20 *AUTO_WIDTH));
    }];

}

#pragma mark UILabel
-(void) setUpChildViewControll:(UILabel *) label backgroundColor:(UIColor *) backgroundColor alpha:(CGFloat) alpha  text:(NSString *) text textColor:(UIColor *) textColor font:(UIFont *) font
{
    label.backgroundColor=backgroundColor;
    label.alpha=alpha;
    label.text=text;
    label.textColor=textColor;
    label.font=font;
//    [self.view addSubview:label];
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
